package ocean.chinacraft.common.world.item;

import ocean.chinacraft.common.config.ApplicationConfig;
import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;

/**
 * 锤子类
 *
 * @author zhang
 * @since 2021/11/22
 */
public class ModHammer extends SwordItem {

    public ModHammer(IItemTier tier, int attackDamage, float attackSpeed, Properties properties) {
        super(tier, attackDamage, attackSpeed, properties);
    }

    @Override
    public ItemStack getContainerItem(ItemStack itemStack) {
        ItemStack stack = itemStack.copy();
        stack.setDamageValue(stack.getDamageValue() + ApplicationConfig.CRAFT_POWDER_HAMMER_CONSUME.get());
        if (stack.getDamageValue() >= itemStack.getMaxDamage()) {
            return ItemStack.EMPTY;
        }
        return stack;
    }

    @Override
    public boolean hasContainerItem(ItemStack stack) {
        return true;
    }
}